﻿Public Class DOCollectionEnumerator
    Implements IEnumerator
    Private m_collection As DOCollection
    Private m_ptr As Integer = -1

    Public Sub New(ByVal c As DOCollection)
        Me.m_collection = c
    End Sub

    Public ReadOnly Property Current() As Object Implements System.Collections.IEnumerator.Current
        Get
            Return Me.m_collection(IIf(Me.m_ptr < 0, 0, m_ptr))
        End Get
    End Property

    Public Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
        Me.m_ptr += 1
        If Me.m_ptr = Me.m_collection.Count Then Return False
        Return True
    End Function

    Public Sub Reset() Implements System.Collections.IEnumerator.Reset
        m_ptr = -1
    End Sub
End Class
